home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / anivga12 / bfffffff.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-07-11  |  2.0 KB  |  69 lines

  1. {$UNDEF test}
  2.  
  3. {$IFDEF test}
  4.  {$A+,B-,D+,E-,F-,G-,I+,L+,N-,O-,R+,S+,V+,X-}
  5.  {$M 16384,65536,655360}
  6. {$ELSE}
  7.  {$A+,B-,D+,E-,F-,G-,I-,L+,N-,O-,R-,S-,V-,X-}
  8.  {$M 16384,65536,655360}
  9. {$ENDIF}
  10.  
  11. PROGRAM CompressionTest;
  12. {Zweck    : Programm zum komprimieren und dekomprimieren von Dateien}
  13. {Autor    : Kai Rohrbacher    }
  14. {Sprache  : TurboPascal 6.0   }
  15. {Datum    : 21.10.1992        }
  16. {Anmerkung: Beim Auftreten eines Fehlers wird dieser nicht weiter analysiert,}
  17. {           was jedoch über den Wert von CompressError möglich wäre.}
  18. USES compression,Dos;
  19. VAR s:STRING;
  20.     ch:CHAR;
  21.     fin,fout:STRING;
  22.     temp:FileOfByte;
  23.     before,total:LONGINT;
  24. BEGIN
  25.  IF ParamCount=3 THEN BEGIN s:=ParamStr(3); ch:=UpCase(s[1]) END;
  26.  IF (ParamCount<>3) OR (NOT (ch IN ['C','K','D']))
  27.   THEN BEGIN
  28.         WRITELN('***Error! Syntax: ',ParamStr(0)+' oldFile newFile {c|d}');
  29.         Halt
  30.        END;
  31.  
  32.  fin:=FExpand(ParamStr(1));
  33.  fout:=FExpand(ParamStr(2));
  34.  IF fin=fout 
  35.   THEN BEGIN
  36.         WRITELN('***Sorry, source and destination files must be different!');
  37.         Halt
  38.        END;
  39.  IF (upcase(ch)='C') OR (upcase(ch)='K')
  40.   THEN BEGIN
  41.         WRITELN('Just a moment, I''ll compress file '+fin+' to file '+fout);
  42.         compress(fin,fout,TRUE);
  43.         IF CompressError<>CompressErr_NoError
  44.          THEN BEGIN
  45.                WRITELN('***Sorry, an error occured!');
  46.                Halt
  47.               END;
  48.         WRITELN('Done!');
  49.  
  50.         _assign(temp,fout); _reset(temp);
  51.         before:=_FileSize(temp);
  52.         total:=FileSize(temp.datei);
  53.         _close(temp);
  54.  
  55.         WRITELN('File compressed to ',total/before*100:5:2,
  56.                 '% of its original size.');
  57.        END
  58.   ELSE BEGIN
  59.         WRITELN('Just a moment, I''ll decompress file '+fin+' to file '+fout);
  60.         decompress(fin,fout,TRUE);
  61.         IF CompressError<>CompressErr_NoError
  62.          THEN BEGIN
  63.                WRITELN('***Sorry, an error occured!');
  64.                Halt
  65.               END;
  66.         WRITELN('Done!');
  67.        END;
  68. END.
  69.